package com.startest.sms.service;

import com.startest.sms.entity.dto.Response;
import com.startest.sms.pojo.Permission;
import com.startest.sms.pojo.Role;
import com.startest.sms.pojo.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List;
import java.util.Map;

public interface UserService {
    Response<String> sendSMS(String phone, HttpServletRequest request);

    Response<String> login(HttpServletRequest request, HttpServletResponse response, String username, String pwd, String autoLogin) throws Exception;
    Response<String> autoLogin(HttpServletRequest request, String token, Date datetime);

    Response<String> addUser(HttpServletRequest request, HttpServletResponse response, String username, String pwd) throws Exception;

    Response<String> phoneReg(String phone, String code, HttpServletRequest request);

    Response<String> phoneLogin(String phone, String code, HttpServletRequest request);

    Response<String> emailReg(String username, String pwd, String email, HttpServletRequest request) throws Exception;

    Response<String> emailCheck(String code);

    User selectUserByName(String username);

    List<Role> selectRoleList();

    Response<String> editRole(Role role);

    List<Permission> selectPermList();

    void editRolePerm(Integer roleId,Integer[] permIds);


    List<Integer> selectPermsByRoleId(Integer roleId);

    void deleteRole(Integer roleId);

    List<Permission> getPermsList();

    Response<String> editPerm(Permission perm);

    Response<String> deletePerm(Integer permId);

    List<User> getUserList();

    Response<String> editUser(User user);

    Response<String> deleteUser(Integer userId);

    Response<List<Integer>> getRoleIdsByUserId(Integer userId);

    List<Map<String,Object>> getRoleTree();

    Response<String> editUserRole(Integer userId, Integer[] roleIds);

    List<Role> getRolesByUser(User user);

    List<Permission> getPermsByRole(Role role);

    User selectUserByPhone(String phone);
}
